package com.sdx.console.ncode.service;

import java.util.List;

import org.beetl.sql.core.SQLManager;
import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.ncode.dao.RightNcodeBatchDao;
import com.sdx.console.ncode.entity.RightNcodeBatch;
import com.ibeetl.admin.core.service.BaseService;

/**
 * N码批次管理 Service
 */

@Service
@Transactional
public class RightNcodeBatchService extends BaseService<RightNcodeBatch>{

    @Resource
	private RightNcodeBatchDao ncodebatchDao;

    public PageQuery<RightNcodeBatch>queryByCondition(PageQuery query){
        PageQuery ret =  ncodebatchDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelRightNcodeBatch(List<String> ids){
        try {
            ncodebatchDao.batchDelRightNcodeBatchByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除N码批次管理失败", e);
        }
    }

    public void updateNcodeExpiredDateByBatchId(RightNcodeBatch rightNcodeBatch,String remark){
        ncodebatchDao.updateNcodeExpiredDateByBatchId(rightNcodeBatch, remark);
    }

	public List<RightNcodeBatch> all() {
		return ncodebatchDao.all();
		}
}
